﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Brain
{
    public class VisualScriptNode_Actor : VisualScriptNode, IUpdateable
    {
        public bool ShouldUpdate { get; set; }

        public List<VisualScriptNode_Condition> Conditions;

        public VisualScriptNode_Actor(VisualScript script)
            : base(script)
        {
            Conditions = new List<VisualScriptNode_Condition>();
            ShouldUpdate = true;
        }

        public void Update()
        {
            bool proceed = true;// Default true, so if there are no Conditions 
                                // it will update
            for (int i = 0; i < Conditions.Count; i++)
            {
                VisualScriptNode_Condition cond = Conditions[i];
                if (cond.Condition)
                {
                    proceed = true;
                }
                else
                {
                    proceed = false;
                    break;
                }
            }

            if (proceed)
            {
                Act();
            }
        }
        public virtual void Act()
        {
        }
    }
}
